<!-- <template>
  <div>
    <el-form
      ref="ruleFormRef"
      :model="ruleForm"
      label-width="auto"
      class="demo-ruleForm"
      :size="formSize"
      status-icon
      style="width: 1100px; margin: auto"
    >
      <el-row :gutter="24">
        <el-col :span="12" :offset="0"
          ><el-form-item label="销售单号:" prop="SalesOrderNumber">
            <el-input
              v-model="inputValue"
              :disabled="isInputDisabled"
            ></el-input>
            <el-checkbox-group
              v-model="checkedType"
              @change="handleCheckboxChange"
            >
              <el-checkbox label="type">系统编号</el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="销售日期" prop="SalesDate">
            <el-date-picker
              v-model="ruleForm.SalesDate"
              type="date"
              placeholder="请选择日期"
              style="width: 100%"
            />
          </el-form-item>
          <el-form-item label="联系人:" prop="LinkMan">
            <el-input v-model.number="ruleForm.LinkMan" />
          </el-form-item>
          <el-form-item label="联系电话:" prop="ContactNumber">
            <el-input v-model="ruleForm.ContactNumber" />
          </el-form-item>
          <el-form-item label="备注" prop="Remark">
            <el-input v-model="ruleForm.Remark" type="textarea" />
          </el-form-item>
        </el-col>
        <el-col :span="12" :offset="0">
          <el-form-item label="客户名称" prop="CustomerName">
            <el-select
              v-model="ruleForm.ClientId"
              placeholder="请选择"
              style="width: 240px"
            >
              <el-option
                v-for="item in CilentList"
                :key="item.ClientId"
                :label="item.ClientName"
                :value="item.ClientId"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="联系方式:" prop="ContactInformation">
            <el-input v-model="ruleForm.ContactInformation" />
          </el-form-item>
          <el-form-item label="收货地址:" prop="DestinationOfDelivery">
            <el-input v-model="ruleForm.DestinationOfDelivery" /> </el-form-item
        ></el-col>
      </el-row>
      <el-button type="primary" @click="submitForm(ruleFormRef)"
        >添加</el-button
      >
      <el-button>移除</el-button>
    </el-form>
  </div>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { ElMessage, ElTable } from "element-plus";
import axios from "axios";
import { reactive } from "vue";
import { useRouter, useRoute } from "vue-router";
const route = useRoute();
const ruleForm = reactive({
  SalesOrderNumber: "",
  CustomerName: "",
  SalesDate: "",
  ContactInformation: "",
  LinkMan: "",
  DestinationOfDelivery: "",
  ContactNumber: "",
  Remark: "",
  ClientId: "",
});
const SaleListref = () => {
  axios.get(`Sale/GetSaleInfo?SaleId=${route.query.SaleId}`).then((res) => {
    ruleForm.SalesOrderNumber = res.data.SalesOrderNumber;
    ruleForm.SalesDate = res.data.SalesDate;
    ruleForm.ClientId = res.data.ClientId;
    ruleForm.LinkMan = res.data.LinkMan;
    ruleForm.ContactInformation = res.data.ContactInformation;
    ruleForm.ContactNumber = res.data.ContactNumber;
    ruleForm.DestinationOfDelivery = res.data.DestinationOfDelivery;
    ruleForm.Remark = res.data.Remark;
  });
};
SaleListref();
</script> -->
 <template>
  <div>
    <table :v-model="ruleForm" style="width: 100%">
      <el-card
        style="
          max-width: 100%;
          max-height: 1000px;
          margin-top: 8px;
          text-align: left;
        "
      >
        <template #header>
          <div class="card-header">
            <el-button type="success" @click="ShowInfo()">返回上一页</el-button>
            <el-button type="info" @click="dialogVisible = true"
              >修改</el-button
            >
          </div>
        </template>
        <el-row :gutter="24">
          <el-col :span="10" :offset="0">
            <span>◆ 基础信息</span>
            <br />
            <br />
            <p>销售单号：{{ ruleForm.SalesOrderNumber }}</p>
            <br />
            <br />
            <p>销售日期：{{ ruleForm.SalesDate }}</p>
            <br />
            <br />
            <p>联系人：{{ ruleForm.LinkMan }}</p>
            <br />
            <br />
            <p>联系电话：{{ ruleForm.ContactNumber }}</p>
            <br />
            <br />
            <p>备注：{{ ruleForm.Remark }}</p>
          </el-col>
          <el-col :span="10" :offset="0">
            <br />
            <br />
            <p>客户名称：{{ ruleForm.ClientId }}</p>
            <br />
            <br />
            <p>联系方式：{{ ruleForm.ContactInformation }}</p>
            <br />
            <br />
            <p>收货地址：{{ ruleForm.DestinationOfDelivery }}</p>
          </el-col>
        </el-row>
        <template #footer>Footer content</template>
      </el-card>
    </table>
    <el-dialog
      v-model="dialogVisible"
      title="Tips"
      width="1200"
      :before-close="handleClose"
    >
      <el-form
        ref="ruleFormRef"
        :model="ruleForm"
        label-width="auto"
        class="demo-ruleForm"
        :size="formSize"
        status-icon
        style="width: 100%; margin: auto"
      >
        <el-row :gutter="24">
          <el-col :span="12" :offset="0"
            ><el-form-item label="销售单号:" prop="SalesOrderNumber">
              <el-input
                v-model="ruleForm.SalesOrderNumber"
                :disabled="isInputDisabled"
              ></el-input>
              <el-checkbox-group
                v-model="checkedType"
                @change="handleCheckboxChange"
              >
                <el-checkbox label="type">系统编号</el-checkbox>
              </el-checkbox-group>
            </el-form-item>
            <el-form-item label="销售日期" prop="SalesDate">
              <el-date-picker
                v-model="ruleForm.SalesDate"
                type="date"
                placeholder="请选择日期"
                style="width: 100%"
              />
            </el-form-item>
            <el-form-item label="联系人:" prop="LinkMan">
              <el-input v-model.number="ruleForm.LinkMan" />
            </el-form-item>
            <el-form-item label="联系电话:" prop="ContactNumber">
              <el-input v-model="ruleForm.ContactNumber" />
            </el-form-item>
            <el-form-item label="备注" prop="Remark">
              <el-input v-model="ruleForm.Remark" type="textarea" />
            </el-form-item>
          </el-col>
          <el-col :span="12" :offset="0">
            <el-form-item label="客户名称" prop="CustomerName">
              <el-select
                v-model="ruleForm.ClientId"
                placeholder="请选择"
                style="width: 240px"
              >
                <el-option
                  v-for="item in CilentList"
                  :key="item.ClientId"
                  :label="item.ClientName"
                  :value="item.ClientId"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="联系方式:" prop="ContactInformation">
              <el-input v-model="ruleForm.ContactInformation" />
            </el-form-item>
            <el-form-item label="收货地址:" prop="DestinationOfDelivery">
              <el-input
                v-model="ruleForm.DestinationOfDelivery"
              /> </el-form-item
          ></el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="UpdateInfo"> 确定 </el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { ElMessage, ElTable } from "element-plus";
import axios from "axios";
import { reactive } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessageBox } from "element-plus";
const CilentList = ref([]);
const dialogVisible = ref(false);
const Router = useRouter();
const route = useRoute();
const ruleForm = reactive({
  SaleId: "",
  SalesOrderNumber: "",
  CustomerName: "",
  SalesDate: "",
  ContactInformation: "",
  LinkMan: "",
  DestinationOfDelivery: "",
  ContactNumber: "",
  Remark: "",
  ClientId: "",
});
const SaleListref = () => {
  axios.get(`Sale/GetSaleInfo?SaleId=${route.query.SaleId}`).then((res) => {
    ruleForm.SaleId = res.data.SaleId;
    ruleForm.SalesOrderNumber = res.data.SalesOrderNumber;
    ruleForm.SalesDate = res.data.SalesDate;
    ruleForm.ClientId = res.data.ClientId;
    ruleForm.LinkMan = res.data.LinkMan;
    ruleForm.ContactInformation = res.data.ContactInformation;
    ruleForm.ContactNumber = res.data.ContactNumber;

    ruleForm.DestinationOfDelivery = res.data.DestinationOfDelivery;
    ruleForm.Remark = res.data.Remark;
  });
};
const GetCilentList = () => {
  axios.get("Sale/GetClients").then((res) => {
    CilentList.value = res.data;
  });
};
const UpdateInfo = () => {
  axios.put("Sale/UpdateSale", ruleForm).then((res) => {
    if (res.data > 0) {
      ElMessage.success("修改成功！");
      dialogVisible.value = false;
    }
  });
};
const ShowInfo = () => {
  Router.push("/UserList/saleshow");
};
SaleListref();
GetCilentList();
</script>
<style>
#app {
  line-height: 20px;
}
#app1 {
  line-height: 20px;
}
</style>